package day09API.stream;

import java.io.FileInputStream;
import java.io.FileOutputStream;

public class FOSDemo01 {
    public static void main(String[] args) throws Exception{

        //如果加了true的构造方法 那么就是以追加的方式
        FileOutputStream fos = new FileOutputStream("./File/fos.txt",true);

        FileInputStream fis = new FileInputStream("./File/fos.txt");
        int n =1;
        for (int i = 0; i <10; i++) {
            fos.write(65);
        }
        byte[] bytes = new byte[100];
        while (true){
            int readCount = fis.read(bytes);
            if (readCount==-1){
                break;
            }
            System.out.println(new String(bytes,0,readCount));
        }
        String s = "我是你爹，傻儿子";
        byte[] bytes1 = s.getBytes();
        fos.write(bytes1);
        fos.close();
        fis.close();
    }
}
